/**************************************************************************//**
 * @file     BSP_pwm.h
 * @brief    PWM related Configuration Header File
 * @version  V1.00
 * @date     25. March 2017
 *
 * @note
 *
 ******************************************************************************/
#ifndef __BSP_PWM_H__
#define __BSP_PWM_H__

/********************************************************************************
 * Include section
 *******************************************************************************/
#include "SC32F58128_pwm.h"

/********************************************************************************
 * Typedefs, structs and enums
 *******************************************************************************/

/********************************************************************************
 * Constants and macros
 *******************************************************************************/
//#define  SYSCLOCK           66000000
//#define  SYSCLOCK_MHZ       66

/* PWM channel definitions */
#define  PWM_PMSM_CHNL0     PWM0
#define  PWM_PMSM_CHNL1     PWM1
#define  PWM_PMSM_CHNL2     PWM2
#define  PWM_FAN_CHNL0      PWM3
#define  PWM_FAN_CHNL1      PWM4
#define  PWM_FAN_CHNL2      PWM5
#define  PWM_SOC_DLY_CHNL   PWM6
#define  PWM_PFC_CHNL       PWM7

//#define  PWM_FREQ                10000   //10K,chenyz
//#define  PWM_DT_2uS              2
//#define  PWM_TURNON_DLY_0uS    ( 0.0)
//#define  PWM_TURNOFF_DLY_0uS   ( 0.0)
//#define  PWM_PRD               ((SYSCLOCK/PWM_FREQ)>>1)  //10K,for updown mode
//#define  PWM_HALF_PRD          ( PWM_PRD>>1)
//#define  PWM_DT_2US            ((SYSCLOCK/1000000)*PWM_DT_2uS)
//#define  PWM_TOTAL_DT_TIME     ( PWM_DT_2US*2)
//#define  PWM_TURN_ON_DLY_TIME  ((SYSCLOCK/1000000)*PWM_TURNON_DLY_0uS)
//#define  PWM_TURN_OFF_DLY_TIME ((SYSCLOCK/1000000)*PWM_TURNOFF_DLY_0uS)

/*******************************************************************************
 * Variables
 ******************************************************************************/
extern struct PWMGEN g_sPfcPwm;
extern struct PWMGEN g_sPmsmPwm;

/*******************************************************************************
 * Prototypes of the functions
 ******************************************************************************/
//extern void PmsmPwmInit(uint8_t chnl1,uint8_t chnl2,uint8_t chnl3,struct PWMGEN str);
//extern void PfcPwmInit (uint8_t chnl,struct PWMGEN str);
extern void BSP_PwmInit(void);

/*---------------------------------- End of the file ---------------------------------*/
#endif /* __BSP_PWM_H__ */

 